﻿using System;
using System.Drawing;
using System.Reflection;
using static Jzb.ConsoleApp.Polymorphic;

namespace Jzb.ConsoleApp
{
    class Program
    {

        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");


            //声明类的类型变量
            //Calculator calculator;
            //calculator = new Calculator();//构造一个实例
            //Console.WriteLine(calculator.StructValue.GetValues());
            //calculator.StructValue.SetX(10);
            //calculator.StructValue = new StructValue(100,20);
            //Console.WriteLine(calculator.StructValue.GetValues());


            //Console.WriteLine(calculator.Location.GetValues());
            //calculator.Location.SetX(100);
            //calculator.Location.Y = 12;
            //Console.WriteLine(calculator.Location.GetValues());

            //int a1 = 1;
            //int result;
            //calculator.Add_2(a1, 10,out result);
            ////Console.WriteLine(a1);

            //Location location = new Location(111,222);
            //Console.WriteLine(location.GetValues());// 111,222

            //calculator.Calc(location);
            //Console.WriteLine(location.GetValues());//666,222

            //StructValue structValue = new StructValue(222,333);
            //Console.WriteLine(structValue.GetValues());// 222,333



            //calculator.Calc(structValue);
            //Console.WriteLine(location.GetValues());//666,222



            //calculator = new Calculator(1);
            //calculator.Test();
            //calculator.Add(1, 2);

            //构造体
            //StructValue structValue = new StructValue(1, 2);
            //Console.WriteLine("structValue: ({0}, {1})", structValue.X, structValue.Y); //structValue: (1, 2)
            //Console.WriteLine(structValue.GetValues());

            //声明张三
            //Person zhangsan = new Person();
            //zhangsan.Name = "张三";
            //zhangsan.Age = 30;
            //zhangsan.Speak(zhangsan.Name+zhangsan.Age);

            //Person lisi = new Person();
            //lisi.Name = "李四";
            //lisi.Age = 30;
            //lisi.Speak(lisi.Name + lisi.Age);

            //Person wangwu = new Man();
            //wangwu.Name = "王五";
            //wangwu.Age = 30;
            ////wangwu.Gender = "女"; 报错 Gender的保护级别是protected 只能在Person的子类使用
            //wangwu.Speak(wangwu.Name + wangwu.Age);

            //Person zhaoliu = new Woman();
            //zhaoliu.Name = "赵六";
            //zhaoliu.Age = 30;
            //var Gender = zhaoliu.Gender;
            //zhaoliu.Speak(zhaoliu.Name + zhaoliu.Age);


            //Chinese wangwu = new Chinese();
            //wangwu.Speak();//讲中文

            //Foregin sunqi = new Foregin();
            //sunqi.Speak();//讲英文

            Person p1 = new Chinese();
            p1.Func1();
            p1.Func2();


            //Animal myAnimal = new Animal(); // 编译错误，Animal类不是抽象类或没有虚方法  
            //Animal myCat = new Cat(); // Animal类型引用指向Cat对象  
            //Animal myDog = new Dog(); // Animal类型引用指向Dog对象  

            //myCat.MakeSound(); // 输出 "Meow"  
            //myDog.MakeSound(); // 输出 "Woof"  
            //myAnimal.MakeSound(); // 输出 "The animal makes a sound"（默认实现）  
        }
    }
}
